/**
 *This program name is MouseRobot use for mouse commands.
 *Copyright (C) 2012  Novin

 *This program is free software; you can redistribute it and/or
 *modify it under the terms of the GNU General Public License
 *as published by the Free Software Foundation; either version 2
 *of the License, or (at your option) any later version.
 *
 *This program is distributed in the hope that it will be useful,
 *but WITHOUT ANY WARRANTY; without even the implied warranty of
 *MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *GNU General Public License for more details.
 *
 *You should have received a copy of the GNU General Public License
 *along with this program; if not, write to the Free Software
 *Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 *
 */
package org.novin.programs;

import java.awt.AWTException;
import java.awt.Robot;
import java.awt.event.InputEvent;

/**
 *
 * @author Acer
 */
public class MouseRobot extends Robot{
    
    //constructor    
    public MouseRobot() throws AWTException{
        super();
    }
    
    //Single Click Event
    public void leftClick(int x, int y){
        mouseMove(x, y);
        mouseRelease(InputEvent.BUTTON1_MASK);
    }
    
    //Double click Event
    public void doubleClick(int x, int y){
        leftClick(x, y);
        leftClick(x, y);
    }    
    
    //triple click Event
    public void tripleClick(int x, int y){
        leftClick(x, y);
        doubleClick(x, y);
    }
    
    //right click event
     public void rightClick(int x, int y){
        mouseMove(x, y);
        mouseRelease(InputEvent.BUTTON3_MASK);
    }
    
     //Middle click
    public void middleClick(int x, int y){
        mouseMove(x, y);
        mouseRelease(InputEvent.BUTTON2_MASK);
    } 
     
    // scrolling upward
    public void scrollUp(int n){
        mouseWheel(-n);
    }
    
    //scrolling downward
    public void scrollDown(int n){
        mouseWheel(n);
    }
    
}
